import { defineComponent } from 'vue';

import { RouteMeta } from '@/types/interface';

export type Component<T = any> =
  | ReturnType<typeof defineComponent>
  | (() => Promise<typeof import('*.vue')>)
  | (() => Promise<T>);

export interface RouteItem {
  /**
   * 主键
   */
  id: number;
  title: string;
  /**
   * 菜单路径信息
   */

  path: string;
  name: string;
  icon?: string;
  /**
   * 类型
   * "0":菜单
   * "1":按钮
   */
  type: number;
  sort: number;
  hide: string;
  redirect: string;
  component?: Component | string;
  children?: Array<RouteItem>;
  meta: RouteMeta;
  keepAlive?: string;
}
